// 引入
const mysql = require('mysql');
const con  = mysql.createConnection({
    host:'localhost',
    port:3306,
    user:'root',
    password:'root',
    database:'demo'
})
con.connect();
//封装
function myquery(sql) {
    return new Promise((resolve,rejiect)=>{
        con.query(sql,(err,result)=>{
            resolve([err,result])
        })
    })
}
// 暴露
module.exports = myquery;